/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package p1;

/**
 *
 * @author Derek Ward
 * 
 * This object is an interpretation of an edge between two
 * nodes.  
 * 
 */
public class Edge
{
    private     Node        source;
    private     Node        destination;
    private     int         weight;
    
    public Edge(Node src, Node dest, int w) throws InvalidEdgeWeightException
    {
        if ( src == null )
            throw new NullPointerException("Edge constructor was passed a null source Node!");
        else
            source = src;
        
        if ( dest == null )
            throw new NullPointerException("Edge constructor was passed a null destination Node!");
        else
            destination = dest;
        
        if ( w < 0 )
            throw new InvalidEdgeWeightException("Edge constructor was passed an invalid weight value!");
        else
            weight = w;
    }
    
    public Node getSourceNode()
    {
        return source;
    }
    
    public Node getDestinationNode()
    {
        return destination;
    }
    
    public int getWeight()
    {
        return weight;
    }
}
